app_name = "upsystem"
app_title = "Upsystem"
app_publisher = "wenhongquan"
app_description = "up"
app_email = "1432244016@qq.com"
app_license = "mit"
app_logo_url = "/assets/upsystem/images/custom-e-logo.svg"
# Apps
# ------------------


# required_apps = []
navbar_items = [

]

doc_route = {

}

# Pages
# ------------------
pages = [
    {
        "name": "my_erpnext_page",
        "template": "upsystem/templates/pages/my_erpnext_page.html",
        "controller": "upsystem.www.my_erpnext_page.get_context"
    },
    {
        "name": "tmsorder",
        "template": "upsystem/templates/pages/tms_order.html",
        "controller": "upsystem.www.tms_order.get_context"
    },
    {
        "name": "tms_tracking",
        "template": "upsystem/templates/pages/tms_tracking.html",
        "controller": "upsystem.www.tms_tracking.get_context"
    },
    {
        "name": "tmsorderdetail",
        "template": "upsystem/templates/pages/tms_order_detail.html",
        "controller": "upsystem.www.tms_order_detail.get_context"
    },
    {
        "name": "tms_exception_order",
        "template": "upsystem/templates/pages/tms_exception_order.html",
        "controller": "upsystem.www.tms_exception_order.get_context"
    },
    {
        "name": "tms_calc",
        "template": "upsystem/templates/pages/tms_calc.html",
        "controller": "upsystem.www.tms_calc.get_context"
    },
    {
        "name": "oms_payment",
        "template": "upsystem/templates/pages/oms_payment.html",
        "controller": "upsystem.www.oms_payment.get_context"
    },
    {
        "name": "oms_tracking",
        "template": "upsystem/templates/pages/oms_tracking.html"
    },
    {
        "name": "oms_exception",
        "template": "upsystem/templates/pages/oms_exception.html"
    }
]

# Website Route Rules
# ------------------
website_route_rules = [
    {
        "from_route": "/upsystem/my_erpnext_page",
        "to_route": "/my_erpnext_page"
    },
    {
        "from_route": "/upsystem/tms_order",
        "to_route": "/tms_order"
    },
    {
        "from_route": "/upsystem/tms_tracking",
        "to_route": "/tms_tracking"
    },
    {
        "from_route": "/upsystem/tms_order_detail",
        "to_route": "/tms_order_detail"
    },
    {
        "from_route": "/upsystem/tms_exception_order",
        "to_route": "/tms_exception_order"
    },
    {
        "from_route": "/upsystem/oms_payment",
        "to_route": "/oms_payment"
    },
    {
        "from_route": "/upsystem/oms_tracking",
        "to_route": "/oms_tracking"
    },
    {
        "from_route": "/upsystem/oms_exception",
        "to_route": "/oms_exception"
    },
    # Custom login routes
    {
        "from_route": "/flowa/login",
        "to_route": "/ups_login"
    }

]

# Each item in the list will be shown as an app in the apps page
# add_to_apps_screen = [
#     {
#         "name": "upsystem",
#         "logo": "/assets/upsystem/logo.png",
#         "title": "Upsystem",
#         "route": "/upsystem",
#         "has_permission": "upsystem.api.permission.has_app_permission"
#     }
# ]

# API modules - wdtcallback functions moved to api.py

# Includes in <head>
# ------------------

# include js, css files in header of desk.html
# app_include_css = "/assets/upsystem/css/tms_common.css"
# app_include_js = "/assets/upsystem/js/tms_common.js"
app_include_css = "/assets/upsystem/css/full_width.css"
app_include_js = "/assets/upsystem/js/full_width.js"

# include js, css files in header of web template
# web_include_css = "/assets/upsystem/css/upsystem.css"
# web_include_js = "/assets/upsystem/js/upsystem.js"
# web_include_js = "/assets/upsystem/js/test.js"

# Website context (favicon etc.)
website_context = {
    "favicon": "/assets/upsystem/images/custom-e-logo.png",
}

# include custom scss in every website theme (without file extension ".scss")
# website_theme_scss = "upsystem/public/scss/website"

# include js, css files in header of web form
# webform_include_js = {"doctype": "public/js/doctype.js"}
# webform_include_css = {"doctype": "public/css/doctype.css"}

# include js in page
# page_js = {"page" : "public/js/file.js"}
page_js = {"test" : "public/js/test.js"}
page_js = {"tmsorder" : "public/js/tms_common.js"}

# include js in doctype views
# doctype_js = {"doctype" : "public/js/doctype.js"}
doctype_list_js = {
    "Item": "public/js/item_sync.js",
    "Sales Order": "public/js/sales_order_sync.js",
    "Material Request": "public/js/material_request_sync.js"
}

# 销售订单 Shopify 物流管理
doctype_list_js["Sales Order"] = [
    "public/js/sales_order_sync.js",
    "public/js/sales_order_shopify_fulfillment.js"
]

# 销售订单自定义状态与 Shopify 概览
doctype_js = {
    "Sales Order" : [
        "public/js/sales_order_custom_status.js",
        "public/js/sales_order_shopify_overview.js",
        "public/js/sales_order_form_wdt.js",
        "public/js/sales_order_form_shopify.js",
        "public/js/sales_order_shopify_fulfillment.js"
    ],
    "Material Request": [
        "public/js/material_request_form.js"
    ]
}

# （已内联到 JS）不再单独引入销售订单自定义状态 CSS
# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
# doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"}

# Svg Icons
# ------------------
# include app icons in desk
# app_include_icons = "upsystem/public/icons.svg"

# Home Pages
# ----------

# application home page (will override Website Settings)
# home_page = "login"

# website user home page (by Role)
# role_home_page = {
#     "Role": "home_page"
# }

# Generators
# ----------

# automatically create page for each record of this doctype
# website_generators = ["Web Page"]

# Jinja
# ----------

# add methods and filters to jinja environment
# jinja = {
#     "methods": "upsystem.utils.jinja_methods",
#     "filters": "upsystem.utils.jinja_filters"
# }

# Installation
# ------------


# Migration
# ---------

# Uninstallation
# ------------


# Integration Setup
# ------------------
# To set up dependencies/integrations with other apps
# Name of the app being installed is passed as an argument

# before_app_install = "upsystem.utils.before_app_install"
# after_app_install = "upsystem.utils.after_app_install"

# Integration Cleanup
# -------------------
# To clean up dependencies/integrations with other apps
# Name of the app being uninstalled is passed as an argument

# before_app_uninstall = "upsystem.utils.before_app_uninstall"
# after_app_uninstall = "upsystem.utils.after_app_uninstall"

# Desk Notifications
# ------------------
# See frappe.core.notifications.get_notification_config

# notification_config = "upsystem.notifications.get_notification_config"

# Permissions
# -----------
# Permissions evaluated in scripted ways

# permission_query_conditions = {
#     "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions",
# }
#
# has_permission = {
#     "Event": "frappe.desk.doctype.event.event.has_permission",
# }

# DocType Class
# ---------------
# Override standard doctype classes

override_doctype_class = {
    "Sales Order": "upsystem.overrides.sales_order.SalesOrder"
}


# Document Events
# ---------------
# Hook on document methods and events

# doc_events = {
#     "*": {
#         "on_update": "method",
#         "on_cancel": "method",
#         "on_trash": "method"
#     }
# }

# Scheduled Tasks
# ---------------

# scheduler_events = {
#     "all": [
#         "upsystem.tasks.all"
#     ],
#     "daily": [
#         "upsystem.tasks.daily"
#     ],
#     "hourly": [
#         "upsystem.tasks.hourly"
#     ],
#     "weekly": [
#         "upsystem.tasks.weekly"
#     ],
#     "monthly": [
#         "upsystem.tasks.monthly"
#     ],
# }

# Testing
# -------

# before_tests = "upsystem.install.before_tests"

# Overriding Methods
# ------------------------------
#
# override_whitelisted_methods = {
#     "frappe.desk.doctype.event.event.get_events": "upsystem.event.get_events"
# }
#
# each overriding function accepts a `data` argument;
# generated from the base implementation of the doctype dashboard,
# along with any modifications made in other Frappe apps
# override_doctype_dashboards = {
#     "Task": "upsystem.task.get_dashboard_data"
# }

# exempt linked doctypes from being automatically cancelled
#
# auto_cancel_exempted_doctypes = ["Auto Repeat"]

# Ignore links to specified DocTypes when deleting documents
# -----------------------------------------------------------

# ignore_links_on_delete = ["Communication", "ToDo"]

# Request Events
# ----------------
# before_request = ["upsystem.utils.before_request"]
# after_request = ["upsystem.utils.after_request"]

# Job Events
# ----------
# before_job = ["upsystem.utils.before_job"]
# after_job = ["upsystem.utils.after_job"]

# User Data Protection
# --------------------

# user_data_fields = [
#     {
#         "doctype": "{doctype_1}",
#         "filter_by": "{filter_by}",
#         "redact_fields": ["{field_1}", "{field_2}"],
#         "partial": 1,
#     },
#     {
#         "doctype": "{doctype_2}",
#         "filter_by": "{filter_by}",
#         "partial": 1,
#     },
#     {
#         "doctype": "{doctype_3}",
#         "strict": False,
#     },
#     {
#         "doctype": "{doctype_4}"
#     }
# ]

# Authentication and authorization
# --------------------------------

# auth_hooks = [
#     "upsystem.auth.validate"
# ]

# Automatically update python controller files with type annotations for this app.
# export_python_type_annotations = True

# default_log_clearing_doctypes = {
#     "Logging DocType Name": 30  # days to retain logs
# }
permission_query_conditions = {
    # "Sales Order": "upsystem.orderpermissions.sales_order.get_permission_query_conditions"
}

# Menu Items
# ------------
# Add menu item to the desktop
menu_items = [
    {
        "module": "Upsystem",
        "label": "My ERPNext Page",
        "icon": "fa fa-file-text-o",
        "type": "page",
        "name": "my_erpnext_page",
        "route": "/upsystem/my_erpnext_page",
        "order": 10
    }
]

# Website Menus
# ------------
website_menus = [
    {
        "name": "Upsystem",
        "title": "Upsystem",
        "items": [
            {
                "label": "My ERPNext Page",
                "route": "/upsystem/my_erpnext_page",
                "icon": "fa fa-file-text-o"
            }
        ]
    }
]

# Custom Fields
# -------------
fixtures = [
    "fixtures/doctype/sales_order_status_override.json"
]

# Document Events
# ---------------
doc_events = {
    "User": {
        "after_insert": "upsystem.overrides.user_send_mail.custom_send_welcome_mail_to_user"
    },
    "Staff User": {
        "after_insert": "upsystem.doctype.staff_user.staff_user.staff_user_after_insert",
        "on_update": "upsystem.doctype.staff_user.staff_user.staff_user_on_update",
    },
}
# 后台任务调度（改由 Server Script 配置）
webhooks = {

}


portal_menu_items = [
 {"title": "我是测试", "route": "/upsystem/my_erpnext_page", "role": "Customer"}
]

# Client Scripts
# ---------------
client_scripts = [
    {
        "doctype": "Item",
        "script": "upsystem.public.js.item_sync"
    }
]
